import Vue from 'vue';
import moment from 'moment/moment';

let filters={
	notescape(html) {
		if(html){
			return html.toString()
				.replace(html ? /&(?!#?\w+;)/g : /&/g, '&amp;')
				.replace(/&lt;/g, "<")
				.replace(/&gt;/g, ">")
				.replace(/&quot;/g, "\"")
				.replace(/&#39;/g, "\'");
		}
	},
	time(value, formatString) {
		formatString = formatString || 'YYYY-MM-DD HH:mm:ss';
		return moment(value).format(formatString);
	}
};
Object.keys(filters).forEach(k => Vue.filter(k, filters[k]));
